home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE22
/
EX7.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-27
|
1KB
|
47 lines
#include <genstub.c>
#include <winnls.h>
BOOL CALLBACK EnumLocales( LPTSTR lpLocaleString )
{
LCID lcid;
TCHAR szBuffer[400];
TCHAR szCountry[96];
TCHAR szLanguage[96];
WideCharToMultiByte( CP_ACP, 0, lpLocaleString, -1, szBuffer, 255, NULL, NULL );
sscanf( (LPSTR) lpLocaleString, "%x", &lcid );
// now get locale data
GetLocaleInfo( lcid, LOCALE_SNATIVECTRYNAME, szCountry, 96 );
GetLocaleInfo( lcid, LOCALE_SNATIVELANGNAME, szLanguage, 96 );
wsprintf( szBuffer, "Locale: %d, Country: %s, Language: %s",
lcid, szCountry, szLanguage );
MessageBox( NULL, szBuffer, "Enumeration of Locales", MB_OK );
return TRUE;
}
LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
static BOOL bFlag = LCID_INSTALLED;
switch (uMsg)
{
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
EnumSystemLocales( EnumLocales, LCID_INSTALLED );
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return (NULL);
}